diff --git a/typescript/angular_ng/created/README.md b/typescript/angular_ng/created/README.md new file mode 100644 index 0000000..950c517 --- /dev/null +++ b/typescript/angular_ng/created/README.md @@ -0,0 +1,59 @@ +# AngularNg + +This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.9. + +## Development server + +To start a local development server, run: + +```bash +ng serve +``` + +Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files. + +## Code scaffolding + +Angular CLI includes powerful code scaffolding tools. To generate a new component, run: + +```bash +ng generate component component-name +``` + +For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run: + +```bash +ng generate --help +``` + +## Building + +To build the project run: + +```bash +ng build +``` + +This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed. + +## Running unit tests + +To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command: + +```bash +ng test +``` + +## Running end-to-end tests + +For end-to-end (e2e) testing, run: + +```bash +ng e2e +``` + +Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs. + +## Additional Resources + +For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page. diff --git a/typescript/angular_ng/created/angular.json b/typescript/angular_ng/created/angular.json new file mode 100644 index 0000000..f90defe --- /dev/null +++ b/typescript/angular_ng/created/angular.json @@ -0,0 +1,97 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "angular_ng": { + "projectType": "application", + "schematics": { + "@schematics/angular:component": { + "inlineTemplate": true, + "inlineStyle": true, + "skipTests": true + }, + "@schematics/angular:class": { + "skipTests": true + }, + "@schematics/angular:directive": { + "skipTests": true + }, + "@schematics/angular:guard": { + "skipTests": true + }, + "@schematics/angular:interceptor": { + "skipTests": true + }, + "@schematics/angular:pipe": { + "skipTests": true + }, + "@schematics/angular:resolver": { + "skipTests": true + }, + "@schematics/angular:service": { + "skipTests": true + } + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:application", + "options": { + "outputPath": "dist/angular_ng", + "index": "src/index.html", + "browser": "src/main.ts", + "polyfills": [ + "zone.js" + ], + "tsConfig": "tsconfig.app.json", + "assets": [ + { + "glob": "**/*", + "input": "public" + } + ], + "styles": [ + "src/styles.css" + ], + "scripts": [], + "allowedCommonJsDependencies": [ + "@bokeh/bokehjs", + "mathjax-full", + "regl" + ] + }, + "configurations": { + "production": { + "budgets": [], + "outputHashing": "all" + }, + "development": { + "optimization": false, + "extractLicenses": false, + "sourceMap": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "buildTarget": "angular_ng:build:production" + }, + "development": { + "buildTarget": "angular_ng:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n" + } + } + } + } +} diff --git a/typescript/angular_ng/created/package.json b/typescript/angular_ng/created/package.json new file mode 100644 index 0000000..6e3e3d6 --- /dev/null +++ b/typescript/angular_ng/created/package.json @@ -0,0 +1,30 @@ +{ + "name": "angular-ng", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "watch": "ng build --watch --configuration development" + }, + "private": true, + "dependencies": { + "@angular/common": "^19.2.0", + "@angular/compiler": "^19.2.0", + "@angular/core": "^19.2.0", + "@angular/forms": "^19.2.0", + "@angular/platform-browser": "^19.2.0", + "@angular/platform-browser-dynamic": "^19.2.0", + "@angular/router": "^19.2.0", + "@bokeh/bokehjs": "file:../../../../bokeh-bokehjs-3.8.0-dev.1.tgz", + "rxjs": "~7.8.0", + "tslib": "^2.3.0", + "zone.js": "~0.15.0" + }, + "devDependencies": { + "@angular-devkit/build-angular": "^19.2.9", + "@angular/cli": "^19.2.9", + "@angular/compiler-cli": "^19.2.0", + "typescript": "~5.7.2" + } +} diff --git a/typescript/angular_ng/created/public/favicon.ico b/typescript/angular_ng/created/public/favicon.ico new file mode 100644 index 0000000..57614f9 Binary files /dev/null and b/typescript/angular_ng/created/public/favicon.ico differ diff --git a/typescript/angular_ng/created/src/app/app.component.ts b/typescript/angular_ng/created/src/app/app.component.ts new file mode 100644 index 0000000..48ed4ab --- /dev/null +++ b/typescript/angular_ng/created/src/app/app.component.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core' +import { BokehJSComponent } from './bokeh-js/bokeh-js.component'; + +@Component({ + selector: 'app-root', + imports: [BokehJSComponent], + template: ``, + styles: [], +}) + +export class AppComponent {} diff --git a/typescript/angular_ng/created/src/app/app.config.ts b/typescript/angular_ng/created/src/app/app.config.ts new file mode 100644 index 0000000..d03bbbc --- /dev/null +++ b/typescript/angular_ng/created/src/app/app.config.ts @@ -0,0 +1,5 @@ +import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; + +export const appConfig: ApplicationConfig = { + providers: [provideZoneChangeDetection({ eventCoalescing: true })] +}; diff --git a/typescript/angular_ng/created/src/app/bokeh-js/bokeh-js.component.ts b/typescript/angular_ng/created/src/app/bokeh-js/bokeh-js.component.ts new file mode 100644 index 0000000..bc2e004 --- /dev/null +++ b/typescript/angular_ng/created/src/app/bokeh-js/bokeh-js.component.ts @@ -0,0 +1,31 @@ +import { Component, OnInit } from '@angular/core' +import * as Bokeh from "@bokeh/bokehjs"; + +function create_bokehjs_plot(): Bokeh.Plotting.Figure { + // Create figure + const plot = Bokeh.Plotting.figure({ + title: "Example BokehJS plot", height: 500, sizing_mode: "stretch_width" + }); + + // Calculate x, y value of sine curve + const x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + const y = x.map(x => Math.sin(Math.PI*x/6)); + + // Plot circles + plot.scatter(x, y, {color: "blue", size: 30, fill_alpha: 0.4}); + + return plot; +} +@Component({ + selector: 'app-bokeh-js', + imports: [], + template: `
`, + styles: `` +}) + +export class BokehJSComponent implements OnInit { + ngOnInit() { + console.info("BokehJS version:", Bokeh.version); + Bokeh.Plotting.show(create_bokehjs_plot(), "#target"); + } +} diff --git a/typescript/angular_ng/created/src/index.html b/typescript/angular_ng/created/src/index.html new file mode 100644 index 0000000..fdb335b --- /dev/null +++ b/typescript/angular_ng/created/src/index.html @@ -0,0 +1,13 @@ + + + + + AngularNg + + + + + + + + diff --git a/typescript/angular_ng/created/src/main.ts b/typescript/angular_ng/created/src/main.ts new file mode 100644 index 0000000..35b00f3 --- /dev/null +++ b/typescript/angular_ng/created/src/main.ts @@ -0,0 +1,6 @@ +import { bootstrapApplication } from '@angular/platform-browser'; +import { appConfig } from './app/app.config'; +import { AppComponent } from './app/app.component'; + +bootstrapApplication(AppComponent, appConfig) + .catch((err) => console.error(err)); diff --git a/typescript/angular_ng/created/src/styles.css b/typescript/angular_ng/created/src/styles.css new file mode 100644 index 0000000..90d4ee0 --- /dev/null +++ b/typescript/angular_ng/created/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/typescript/angular_ng/created/tsconfig.app.json b/typescript/angular_ng/created/tsconfig.app.json new file mode 100644 index 0000000..3775b37 --- /dev/null +++ b/typescript/angular_ng/created/tsconfig.app.json @@ -0,0 +1,15 @@ +/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ +/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": [ + "src/main.ts" + ], + "include": [ + "src/**/*.d.ts" + ] +} diff --git a/typescript/angular_ng/created/tsconfig.json b/typescript/angular_ng/created/tsconfig.json new file mode 100644 index 0000000..5525117 --- /dev/null +++ b/typescript/angular_ng/created/tsconfig.json @@ -0,0 +1,27 @@ +/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */ +/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */ +{ + "compileOnSave": false, + "compilerOptions": { + "outDir": "./dist/out-tsc", + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + "isolatedModules": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "moduleResolution": "bundler", + "importHelpers": true, + "target": "ES2022", + "module": "ES2022" + }, + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/typescript/react_vite/created/README.md b/typescript/react_vite/created/README.md new file mode 100644 index 0000000..da98444 --- /dev/null +++ b/typescript/react_vite/created/README.md @@ -0,0 +1,54 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +Currently, two official plugins are available: + +- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh +- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: + +```js +export default tseslint.config({ + extends: [ + // Remove ...tseslint.configs.recommended and replace with this + ...tseslint.configs.recommendedTypeChecked, + // Alternatively, use this for stricter rules + ...tseslint.configs.strictTypeChecked, + // Optionally, add this for stylistic rules + ...tseslint.configs.stylisticTypeChecked, + ], + languageOptions: { + // other options... + parserOptions: { + project: ['./tsconfig.node.json', './tsconfig.app.json'], + tsconfigRootDir: import.meta.dirname, + }, + }, +}) +``` + +You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: + +```js +// eslint.config.js +import reactX from 'eslint-plugin-react-x' +import reactDom from 'eslint-plugin-react-dom' + +export default tseslint.config({ + plugins: { + // Add the react-x and react-dom plugins + 'react-x': reactX, + 'react-dom': reactDom, + }, + rules: { + // other rules... + // Enable its recommended typescript rules + ...reactX.configs['recommended-typescript'].rules, + ...reactDom.configs.recommended.rules, + }, +}) +``` diff --git a/typescript/react_vite/created/eslint.config.js b/typescript/react_vite/created/eslint.config.js new file mode 100644 index 0000000..092408a --- /dev/null +++ b/typescript/react_vite/created/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +) diff --git a/typescript/react_vite/created/index.html b/typescript/react_vite/created/index.html new file mode 100644 index 0000000..e4b78ea --- /dev/null +++ b/typescript/react_vite/created/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + TS + + +
+ + + diff --git a/typescript/react_vite/created/package.json b/typescript/react_vite/created/package.json new file mode 100644 index 0000000..7789697 --- /dev/null +++ b/typescript/react_vite/created/package.json @@ -0,0 +1,30 @@ +{ + "name": "react_vite", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "eslint .", + "preview": "vite preview" + }, + "dependencies": { + "@bokeh/bokehjs": "file:../../../../bokeh-bokehjs-3.8.0-dev.1.tgz", + "react": "^19.0.0", + "react-dom": "^19.0.0" + }, + "devDependencies": { + "@eslint/js": "^9.22.0", + "@types/react": "^19.0.10", + "@types/react-dom": "^19.0.4", + "@vitejs/plugin-react": "^4.3.4", + "eslint": "^9.22.0", + "eslint-plugin-react-hooks": "^5.2.0", + "eslint-plugin-react-refresh": "^0.4.19", + "globals": "^16.0.0", + "typescript": "~5.7.2", + "typescript-eslint": "^8.26.1", + "vite": "^6.3.1" + } +} diff --git a/typescript/react_vite/created/src/App.tsx b/typescript/react_vite/created/src/App.tsx new file mode 100644 index 0000000..a80a029 --- /dev/null +++ b/typescript/react_vite/created/src/App.tsx @@ -0,0 +1,11 @@ +import { BokehComponent } from './BokehComponent.tsx' + +function App() { + return ( + <> + + + ) +} + +export default App diff --git a/typescript/react_vite/created/src/BokehComponent.tsx b/typescript/react_vite/created/src/BokehComponent.tsx new file mode 100644 index 0000000..9fd962f --- /dev/null +++ b/typescript/react_vite/created/src/BokehComponent.tsx @@ -0,0 +1,35 @@ +import { useEffect, useRef } from 'react' +import * as Bokeh from "@bokeh/bokehjs"; + +console.info("BokehJS version:", Bokeh.version); + +function create_bokehjs_plot(): Bokeh.Plotting.Figure { + // Create figure + const plot = Bokeh.Plotting.figure({ + title: "Example BokehJS plot", height: 500, sizing_mode: "stretch_width" + }); + + // Calculate x, y value of sine curve + const x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + const y = x.map(x => Math.sin(Math.PI*x/6)); + + // Plot circles + plot.scatter(x, y, {color: "blue", size: 30, fill_alpha: 0.4}); + + return plot; +} +export function BokehComponent() { + const shown = useRef(false); + useEffect(() => { + if (!shown.current) { + Bokeh.Plotting.show(create_bokehjs_plot(), "#target"); + shown.current = true; + } + }, []) + + return ( + <> +
+ + ) +} diff --git a/typescript/react_vite/created/src/main.tsx b/typescript/react_vite/created/src/main.tsx new file mode 100644 index 0000000..4aff025 --- /dev/null +++ b/typescript/react_vite/created/src/main.tsx @@ -0,0 +1,9 @@ +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import App from './App.tsx' + +createRoot(document.getElementById('root')!).render( + + + , +) diff --git a/typescript/react_vite/created/src/vite-env.d.ts b/typescript/react_vite/created/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/typescript/react_vite/created/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/typescript/react_vite/created/tsconfig.app.json b/typescript/react_vite/created/tsconfig.app.json new file mode 100644 index 0000000..358ca9b --- /dev/null +++ b/typescript/react_vite/created/tsconfig.app.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/typescript/react_vite/created/tsconfig.json b/typescript/react_vite/created/tsconfig.json new file mode 100644 index 0000000..1ffef60 --- /dev/null +++ b/typescript/react_vite/created/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/typescript/react_vite/created/tsconfig.node.json b/typescript/react_vite/created/tsconfig.node.json new file mode 100644 index 0000000..db0becc --- /dev/null +++ b/typescript/react_vite/created/tsconfig.node.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/typescript/react_vite/created/vite.config.ts b/typescript/react_vite/created/vite.config.ts new file mode 100644 index 0000000..8b0f57b --- /dev/null +++ b/typescript/react_vite/created/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [react()], +}) diff --git a/typescript/vanilla_rspack/created/assets/index.html b/typescript/vanilla_rspack/created/assets/index.html new file mode 100644 index 0000000..2481c02 --- /dev/null +++ b/typescript/vanilla_rspack/created/assets/index.html @@ -0,0 +1,10 @@ + + + + BokehJS example: typescript vanilla rspack + + + +
+ + diff --git a/typescript/vanilla_rspack/created/package.json b/typescript/vanilla_rspack/created/package.json new file mode 100644 index 0000000..dc0c612 --- /dev/null +++ b/typescript/vanilla_rspack/created/package.json @@ -0,0 +1,24 @@ +{ + "name": "vanilla_rspack", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "rspack build", + "serve": "rspack serve" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "devDependencies": { + "@rspack/cli": "^1.3.8", + "@rspack/core": "^1.3.8", + "ts-loader": "^9.5.2", + "ts-node": "^10.9.2", + "typescript": "^5.8.3" + }, + "dependencies": { + "@bokeh/bokehjs": "file:../../../../bokeh-bokehjs-3.8.0-dev.1.tgz" + } +} diff --git a/typescript/vanilla_rspack/created/rspack.config.ts b/typescript/vanilla_rspack/created/rspack.config.ts new file mode 100644 index 0000000..a58910e --- /dev/null +++ b/typescript/vanilla_rspack/created/rspack.config.ts @@ -0,0 +1,21 @@ +import path from 'path'; +import { Configuration } from '@rspack/cli'; + +const config: Configuration = { + entry: './src/index.ts', + mode: 'development', + module: { + rules: [ + { test: /\.ts/, use: "ts-loader", exclude: /node_modules/ } + ], + }, + output: { filename: 'bundle.js' }, + devServer: { + static: { + directory: path.join(__dirname, 'assets'), + }, + port: 4500, + }, +}; + +export default config; diff --git a/typescript/vanilla_rspack/created/src/index.ts b/typescript/vanilla_rspack/created/src/index.ts new file mode 100644 index 0000000..95d26d3 --- /dev/null +++ b/typescript/vanilla_rspack/created/src/index.ts @@ -0,0 +1,20 @@ +import * as Bokeh from "@bokeh/bokehjs"; + +console.info("BokehJS version:", Bokeh.version); + +function create_bokehjs_plot(): Bokeh.Plotting.Figure { + // Create figure + const plot = Bokeh.Plotting.figure({ + title: "Example BokehJS plot", height: 500, sizing_mode: "stretch_width" + }); + + // Calculate x, y value of sine curve + const x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + const y = x.map(x => Math.sin(Math.PI*x/6)); + + // Plot circles + plot.scatter(x, y, {color: "blue", size: 30, fill_alpha: 0.4}); + + return plot; +} +Bokeh.Plotting.show(create_bokehjs_plot(), "#target"); diff --git a/typescript/vanilla_rspack/created/tsconfig.json b/typescript/vanilla_rspack/created/tsconfig.json new file mode 100644 index 0000000..45c6e8e --- /dev/null +++ b/typescript/vanilla_rspack/created/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "esModuleInterop": true, + "moduleResolution": "node", + "outDir": "./dist", + "rootDir": "./src", + "target": "ES2022" + }, + "include": ["src"] +} diff --git a/typescript/vanilla_vite/created/index.html b/typescript/vanilla_vite/created/index.html new file mode 100644 index 0000000..44a9335 --- /dev/null +++ b/typescript/vanilla_vite/created/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + TS + + +
+ + + diff --git a/typescript/vanilla_vite/created/package.json b/typescript/vanilla_vite/created/package.json new file mode 100644 index 0000000..7a9f020 --- /dev/null +++ b/typescript/vanilla_vite/created/package.json @@ -0,0 +1,18 @@ +{ + "name": "vanilla_vite", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "typescript": "~5.7.2", + "vite": "^6.3.1" + }, + "dependencies": { + "@bokeh/bokehjs": "file:../../../../bokeh-bokehjs-3.8.0-dev.1.tgz" + } +} diff --git a/typescript/vanilla_vite/created/src/main.ts b/typescript/vanilla_vite/created/src/main.ts new file mode 100644 index 0000000..11ce9df --- /dev/null +++ b/typescript/vanilla_vite/created/src/main.ts @@ -0,0 +1,22 @@ +import * as Bokeh from "@bokeh/bokehjs"; + +console.info("BokehJS version:", Bokeh.version); + +function create_bokehjs_plot(): Bokeh.Plotting.Figure { + // Create figure + const plot = Bokeh.Plotting.figure({ + title: "Example BokehJS plot", height: 500, sizing_mode: "stretch_width" + }); + + // Calculate x, y value of sine curve + const x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + const y = x.map(x => Math.sin(Math.PI*x/6)); + + // Plot circles + plot.scatter(x, y, {color: "blue", size: 30, fill_alpha: 0.4}); + + return plot; +} +document.querySelector('#app')!.innerHTML = `
`; + +Bokeh.Plotting.show(create_bokehjs_plot(), "#target"); diff --git a/typescript/vanilla_vite/created/src/vite-env.d.ts b/typescript/vanilla_vite/created/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/typescript/vanilla_vite/created/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/typescript/vanilla_vite/created/tsconfig.json b/typescript/vanilla_vite/created/tsconfig.json new file mode 100644 index 0000000..a4883f2 --- /dev/null +++ b/typescript/vanilla_vite/created/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/typescript/vanilla_webpack/created/assets/index.html b/typescript/vanilla_webpack/created/assets/index.html new file mode 100644 index 0000000..3ae7960 --- /dev/null +++ b/typescript/vanilla_webpack/created/assets/index.html @@ -0,0 +1,10 @@ + + + + BokehJS example: typescript vanilla webpack + + + +
+ + diff --git a/typescript/vanilla_webpack/created/package.json b/typescript/vanilla_webpack/created/package.json new file mode 100644 index 0000000..b02e2f1 --- /dev/null +++ b/typescript/vanilla_webpack/created/package.json @@ -0,0 +1,25 @@ +{ + "name": "vanilla_webpack", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "webpack build", + "serve": "webpack serve" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "devDependencies": { + "ts-loader": "^9.5.2", + "ts-node": "^10.9.2", + "typescript": "^5.8.3", + "webpack": "^5.99.7", + "webpack-cli": "^6.0.1", + "webpack-dev-server": "^5.2.1" + }, + "dependencies": { + "@bokeh/bokehjs": "file:../../../../bokeh-bokehjs-3.8.0-dev.1.tgz" + } +} diff --git a/typescript/vanilla_webpack/created/src/index.ts b/typescript/vanilla_webpack/created/src/index.ts new file mode 100644 index 0000000..95d26d3 --- /dev/null +++ b/typescript/vanilla_webpack/created/src/index.ts @@ -0,0 +1,20 @@ +import * as Bokeh from "@bokeh/bokehjs"; + +console.info("BokehJS version:", Bokeh.version); + +function create_bokehjs_plot(): Bokeh.Plotting.Figure { + // Create figure + const plot = Bokeh.Plotting.figure({ + title: "Example BokehJS plot", height: 500, sizing_mode: "stretch_width" + }); + + // Calculate x, y value of sine curve + const x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; + const y = x.map(x => Math.sin(Math.PI*x/6)); + + // Plot circles + plot.scatter(x, y, {color: "blue", size: 30, fill_alpha: 0.4}); + + return plot; +} +Bokeh.Plotting.show(create_bokehjs_plot(), "#target"); diff --git a/typescript/vanilla_webpack/created/tsconfig.json b/typescript/vanilla_webpack/created/tsconfig.json new file mode 100644 index 0000000..45c6e8e --- /dev/null +++ b/typescript/vanilla_webpack/created/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "esModuleInterop": true, + "moduleResolution": "node", + "outDir": "./dist", + "rootDir": "./src", + "target": "ES2022" + }, + "include": ["src"] +} diff --git a/typescript/vanilla_webpack/created/webpack.config.ts b/typescript/vanilla_webpack/created/webpack.config.ts new file mode 100644 index 0000000..a56d72c --- /dev/null +++ b/typescript/vanilla_webpack/created/webpack.config.ts @@ -0,0 +1,22 @@ +import path from 'path'; +import webpack from 'webpack'; +import 'webpack-dev-server'; + +const config: webpack.Configuration = { + entry: './src/index.ts', + mode: 'development', + module: { + rules: [ + { test: /\.ts/, use: "ts-loader", exclude: /node_modules/ } + ], + }, + output: { filename: 'bundle.js' }, + devServer: { + static: { + directory: path.join(__dirname, 'assets'), + }, + port: 4500, + }, +}; + +export default config; diff --git a/typescript/vue_vite/created/README.md b/typescript/vue_vite/created/README.md new file mode 100644 index 0000000..33895ab --- /dev/null +++ b/typescript/vue_vite/created/README.md @@ -0,0 +1,5 @@ +# Vue 3 + TypeScript + Vite + +This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 ` + + diff --git a/typescript/vue_vite/created/package.json b/typescript/vue_vite/created/package.json new file mode 100644 index 0000000..bfeb5e1 --- /dev/null +++ b/typescript/vue_vite/created/package.json @@ -0,0 +1,22 @@ +{ + "name": "vue_vite", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc -b && vite build", + "preview": "vite preview" + }, + "dependencies": { + "@bokeh/bokehjs": "file:../../../../bokeh-bokehjs-3.8.0-dev.1.tgz", + "vue": "^3.5.13" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^5.2.2", + "@vue/tsconfig": "^0.7.0", + "typescript": "~5.7.2", + "vite": "^6.3.1", + "vue-tsc": "^2.2.8" + } +} diff --git a/typescript/vue_vite/created/src/App.vue b/typescript/vue_vite/created/src/App.vue new file mode 100644 index 0000000..eead56b --- /dev/null +++ b/typescript/vue_vite/created/src/App.vue @@ -0,0 +1,7 @@ + + + diff --git a/typescript/vue_vite/created/src/components/BokehComponent.vue b/typescript/vue_vite/created/src/components/BokehComponent.vue new file mode 100644 index 0000000..169ff42 --- /dev/null +++ b/typescript/vue_vite/created/src/components/BokehComponent.vue @@ -0,0 +1,30 @@ + + + diff --git a/typescript/vue_vite/created/src/main.ts b/typescript/vue_vite/created/src/main.ts new file mode 100644 index 0000000..01433bc --- /dev/null +++ b/typescript/vue_vite/created/src/main.ts @@ -0,0 +1,4 @@ +import { createApp } from 'vue' +import App from './App.vue' + +createApp(App).mount('#app') diff --git a/typescript/vue_vite/created/src/vite-env.d.ts b/typescript/vue_vite/created/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/typescript/vue_vite/created/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/typescript/vue_vite/created/tsconfig.app.json b/typescript/vue_vite/created/tsconfig.app.json new file mode 100644 index 0000000..7fb078c --- /dev/null +++ b/typescript/vue_vite/created/tsconfig.app.json @@ -0,0 +1,14 @@ +{ + "extends": "@vue/tsconfig/tsconfig.dom.json", + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"] +} diff --git a/typescript/vue_vite/created/tsconfig.json b/typescript/vue_vite/created/tsconfig.json new file mode 100644 index 0000000..1ffef60 --- /dev/null +++ b/typescript/vue_vite/created/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/typescript/vue_vite/created/tsconfig.node.json b/typescript/vue_vite/created/tsconfig.node.json new file mode 100644 index 0000000..db0becc --- /dev/null +++ b/typescript/vue_vite/created/tsconfig.node.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/typescript/vue_vite/created/vite.config.ts b/typescript/vue_vite/created/vite.config.ts new file mode 100644 index 0000000..bbcf80c --- /dev/null +++ b/typescript/vue_vite/created/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [vue()], +})