@mlightcad/ribbon 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.github/workflows/ci.yml +110 -0
  2. package/.vscode/extensions.json +3 -0
  3. package/AGENTS.md +42 -0
  4. package/README.md +168 -0
  5. package/docs/requirements.md +96 -0
  6. package/eslint.config.js +41 -0
  7. package/images/ribbon.jpg +0 -0
  8. package/index.html +13 -0
  9. package/package.json +43 -0
  10. package/playwright/ribbon.spec.ts +6 -0
  11. package/playwright.config.ts +10 -0
  12. package/public/favicon.svg +1 -0
  13. package/public/icons.svg +24 -0
  14. package/src/App.vue +418 -0
  15. package/src/assets/hero.png +0 -0
  16. package/src/assets/vite.svg +1 -0
  17. package/src/assets/vue.svg +1 -0
  18. package/src/components/HelloWorld.vue +106 -0
  19. package/src/main.ts +9 -0
  20. package/src/ribbon/components/Ribbon.vue +844 -0
  21. package/src/ribbon/components/RibbonCollection.vue +51 -0
  22. package/src/ribbon/components/RibbonGroup.vue +327 -0
  23. package/src/ribbon/components/RibbonGroupContent.vue +61 -0
  24. package/src/ribbon/components/RibbonItemHost.vue +221 -0
  25. package/src/ribbon/components/RibbonTab.vue +44 -0
  26. package/src/ribbon/components/RibbonTabs.vue +49 -0
  27. package/src/ribbon/composables/useRibbonState.ts +272 -0
  28. package/src/ribbon/context.ts +4 -0
  29. package/src/ribbon/index.ts +99 -0
  30. package/src/ribbon/items/RibbonGallery.vue +78 -0
  31. package/src/ribbon/items/RibbonGroupButton.vue +85 -0
  32. package/src/ribbon/items/RibbonTemplateItem.vue +38 -0
  33. package/src/ribbon/modules/RibbonBackstage.vue +69 -0
  34. package/src/ribbon/modules/RibbonContextualTabs.vue +65 -0
  35. package/src/ribbon/modules/RibbonFileMenu.vue +88 -0
  36. package/src/ribbon/modules/RibbonKeyTips.vue +114 -0
  37. package/src/ribbon/styles/ribbon.css +925 -0
  38. package/src/ribbon/types.ts +162 -0
  39. package/src/style.css +328 -0
  40. package/src/tests/ribbon.spec.ts +830 -0
  41. package/src/tests/setup.ts +4 -0
  42. package/tools/release.mjs +107 -0
  43. package/tsconfig.app.json +14 -0
  44. package/tsconfig.json +7 -0
  45. package/tsconfig.node.json +24 -0
  46. package/vite.config.ts +38 -0
@@ -0,0 +1,4 @@
1
+ import { config } from '@vue/test-utils'
2
+ import ElementPlus from 'element-plus'
3
+
4
+ config.global.plugins = [ElementPlus]
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+ import { execSync } from 'node:child_process';
3
+
4
+ function run(cmd) {
5
+ return execSync(cmd, {
6
+ encoding: 'utf8',
7
+ stdio: ['ignore', 'pipe', 'pipe'],
8
+ }).trim();
9
+ }
10
+
11
+ function fail(msg) {
12
+ console.error(`❌ ${msg}`);
13
+ process.exit(1);
14
+ }
15
+
16
+ /**
17
+ * Parse vX.Y.Z
18
+ */
19
+ function parseVersion(tag) {
20
+ const m = tag.match(/^v(\d+)\.(\d+)\.(\d+)$/);
21
+ if (!m) return null;
22
+ return {
23
+ major: Number(m[1]),
24
+ minor: Number(m[2]),
25
+ patch: Number(m[3]),
26
+ };
27
+ }
28
+
29
+ /**
30
+ * Find latest vX.Y.Z tag (sorted by semver, not by time)
31
+ */
32
+ function findLatestTag() {
33
+ const output = run('git tag --list "v*.*.*"');
34
+ if (!output) return null;
35
+
36
+ const tags = output
37
+ .split('\n')
38
+ .map(t => ({ tag: t, v: parseVersion(t) }))
39
+ .filter(t => t.v !== null);
40
+
41
+ if (tags.length === 0) return null;
42
+
43
+ tags.sort((a, b) => {
44
+ if (a.v.major !== b.v.major) return b.v.major - a.v.major;
45
+ if (a.v.minor !== b.v.minor) return b.v.minor - a.v.minor;
46
+ return b.v.patch - a.v.patch;
47
+ });
48
+
49
+ return tags[0].tag;
50
+ }
51
+
52
+ /**
53
+ * Main
54
+ */
55
+ let version = process.argv[2];
56
+
57
+ if (!version) {
58
+ const latestTag = findLatestTag();
59
+ if (!latestTag) {
60
+ fail('No existing vX.Y.Z tag found, please specify a version explicitly.');
61
+ }
62
+
63
+ const v = parseVersion(latestTag);
64
+ version = `${v.major}.${v.minor}.${v.patch + 1}`;
65
+
66
+ console.log(`ℹ️ No version provided, auto-incrementing patch: ${latestTag} → v${version}`);
67
+ }
68
+
69
+ if (!/^\d+\.\d+\.\d+$/.test(version)) {
70
+ fail(`Invalid version "${version}". Expected format: X.Y.Z`);
71
+ }
72
+
73
+ const tag = `v${version}`;
74
+
75
+ /**
76
+ * Safety checks
77
+ */
78
+ try {
79
+ run(`git rev-parse --verify refs/tags/${tag}`);
80
+ fail(`Tag ${tag} already exists.`);
81
+ } catch {
82
+ // tag does not exist → OK
83
+ }
84
+
85
+ try {
86
+ const branch = run('git branch --show-current');
87
+ if (branch !== 'main') {
88
+ fail(`Current branch is "${branch}". Please release from "main".`);
89
+ }
90
+ } catch {
91
+ // non-fatal
92
+ }
93
+
94
+ const status = run('git status --porcelain');
95
+ if (status) {
96
+ fail('Working tree is not clean. Please commit or stash changes.');
97
+ }
98
+
99
+ /**
100
+ * Create & push annotated tag
101
+ */
102
+ console.log(`🚀 Creating tag ${tag}`);
103
+
104
+ run(`git tag -a ${tag} -m "release: release ${tag}"`);
105
+ run(`git push origin ${tag}`);
106
+
107
+ console.log(`✅ Release tag ${tag} pushed successfully`);
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "types": ["vite/client"],
6
+
7
+ /* Linting */
8
+ "noUnusedLocals": true,
9
+ "noUnusedParameters": true,
10
+ "erasableSyntaxOnly": true,
11
+ "noFallthroughCasesInSwitch": true
12
+ },
13
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
14
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "es2023",
5
+ "lib": ["ES2023"],
6
+ "module": "esnext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+
17
+ /* Linting */
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "erasableSyntaxOnly": true,
21
+ "noFallthroughCasesInSwitch": true
22
+ },
23
+ "include": ["vite.config.ts"]
24
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,38 @@
1
+ import { resolve } from 'node:path'
2
+ import { defineConfig } from 'vitest/config'
3
+ import vue from '@vitejs/plugin-vue'
4
+
5
+ export default defineConfig(({ mode }) => {
6
+ const isLibBuild = mode === 'lib'
7
+
8
+ return {
9
+ plugins: [vue()],
10
+ build: isLibBuild
11
+ ? {
12
+ lib: {
13
+ entry: resolve(__dirname, 'src/ribbon/index.ts'),
14
+ name: 'MlRibbon',
15
+ formats: ['es', 'umd'],
16
+ fileName: (format) => `ml-ribbon.${format}.js`,
17
+ },
18
+ rollupOptions: {
19
+ external: [/^vue(\/.*)?$/, /^element-plus(\/.*)?$/, /^@element-plus\/icons-vue(\/.*)?$/],
20
+ output: {
21
+ globals: {
22
+ vue: 'Vue',
23
+ 'element-plus': 'ElementPlus',
24
+ '@element-plus/icons-vue': 'ElementPlusIconsVue',
25
+ },
26
+ },
27
+ },
28
+ }
29
+ : undefined,
30
+ test: {
31
+ environment: 'jsdom',
32
+ globals: true,
33
+ setupFiles: ['./src/tests/setup.ts'],
34
+ include: ['src/tests/**/*.spec.ts'],
35
+ exclude: ['playwright/**', 'node_modules/**'],
36
+ },
37
+ }
38
+ })